import Mock from 'mockjs'

const keepList = {
  status: 'success',
  totalItems: 19,
  'data|10': [
    {
      KEEPWINE_ID: '@string(32)',
      NUMBER:'20181212100'+'@integer(100000000, 999999999)',
      CUSTOMER_NAME: '@cname',
      'PHONE|1': ['13567686796','13267684332','13672154235'],
      DATETIME:'@datetime("yyyy-MM-dd HH:mm")',
      KEEPER: '@cname',
      'keeper_DEPARTMENT|1':['营销部','市场部','楼面部','演义部','工程部'],
      'STATE|1':[0,1,2,3],//0-检查中 1-存酒中 2-成功 3-失败
      total:'@integer(1, 10)',
      'REMARK|1':['','@csentence']
    }
  ]
}

const keepDetail = {
  status: 'success',
  data: function(){
      let keepDetail = Mock.mock({
        KEEPWINE_ID: '@string(32)',
        NUMBER:'20181212100'+'@integer(100000000, 999999999)',
        CUSTOMER_NAME: '@cname',
        'PHONE|1': ['13567686796','13267684332','13672154235'],
        DATETIME:'@datetime("yyyy-MM-dd HH:mm")',
        KEEPER: '@cname',
        'keeper_DEPARTMENT|1':['营销部','市场部','楼面部','演义部','工程部'],
        'STATE|1':[0,1,2,3],//0-检查中 1-存酒中 2-成功 3-失败
        'REMARK|1':['','@csentence'],
        detailList:[]
      }),keepDetailListItem = null,loop = Mock.Random.integer(1,3)
      for(var j = 0; j < loop; j++){
        let whole = Mock.Random.boolean()?1:0
        let quantity = whole == 1?Mock.Random.integer(1, 10):1
        let scale = whole == 0?Mock.Random.float(5, 15, 1, 1):0
        keepDetailListItem = Mock.mock({
          KEEPWINEDETAILS_ID:'@string(32)',
          NAME:'@ctitle(5,20)',
          EXPIRE_DATETIME:'@datetime("yyyy-MM-dd")',
          'UNIT|1':['支','甁','罐','套','盘'],
          WHOLE:whole,
          QUANTITY:quantity,
          SCALE:scale,
          'PRICE|500-10000.2': 1,
          'STATE|1':[0,1,2]//0-存放中 1-已取出 2-过期 3-取酒中
        })
        keepDetail.detailList.push(keepDetailListItem)
      }
      return keepDetail
    }
}

const personKeepList = {
  status: 'success',
  totalItems: 19,
  data: function(){
    let keepDetail = [],keepDetailListItem = null,loop = Mock.Random.integer(2,5)
    for(var j = 0; j < loop; j++){
      let whole = Mock.Random.boolean()?1:0
      let quantity = whole == 1?Mock.Random.integer(1, 10):1
      let scale = whole == 0?Mock.Random.float(5, 15, 1, 1):0
      keepDetailListItem = Mock.mock({
        KEEPWINEDETAILS_ID:'@string(32)',
        NAME:'@ctitle(5,20)',
        EXPIRE_DATETIME:'@datetime("yyyy-MM-dd")',
        'UNIT|1':['支','甁','罐','套','盘'],
        WHOLE:whole,
        QUANTITY:quantity,
        selectable:Mock.Random.boolean(),
        SCALE:scale,
        'PRICE|500-10000.2': 1,
        'STATE|1':[0,1,2]
      })
      keepDetail.push(keepDetailListItem)
    }
    return keepDetail
  }
}

const withDrawStatus = {
  status:'success',
  msg:'后端返回的提示信息'
}

export {keepList,keepDetail,personKeepList,withDrawStatus}
